{% extends 'core/edit/index.html' %}

{% load i18n static filters %}

{% block 'scripts' %}
    <script src="{% static 'js/edit_profile.js' %}"></script>
{% endblock %}

{% block 'subcontent' %}
<h2>{{ politician.first_name }} {{ politician.last_name }}</h2>
<form id="profile" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    <div class="row bottom-buffer">
        <div class="col-md-4">
            <div class="form-group {% if form.first_name.errors %}has-error{% endif %}">
                {{ form.first_name|label_with_class:'control-label' }}
                {{ form.first_name }}
            </div>
            <div class="form-group visible-xs">
                {{ form.last_name|label_with_class:'control-label' }}
                {{ form.last_name }}
            </div>
            <div class="form-group {% if form.email.errors %}has-error{% endif %}">
                {{ form.email|label_with_class:'control-label' }}
                {{ form.email }}
            </div>
            <div class="form-group {% if form.is_member_of_parliament.errors %}has-error{% endif %}">
                {{ form.is_member_of_parliament }}
                {{ form.is_member_of_parliament|label_with_class:'control-label' }}
            </div>
            <div class="row">
                <div class="col-md-6 {% if form.state.errors %}has-error{% endif %}">
                    <div class="form-group">
                        {{ form.state|label_with_class:'control-label' }}
                        {{ form.state }}
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group {% if form.party.errors %}has-error{% endif %}">
                        {{ form.party|label_with_class:'control-label' }}
                        {{ form.party }}
                    </div>
                    <div class="form-group {% if form.party_other.errors %}has-error{% endif %}">
                        <a id="toggle-party" href="#">{% trans 'other' %}...</a>
                        {{ form.party_other }}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-4 {% if form.last_name.errors %}has-error{% endif %}">
            <div class="form-group hidden-xs">
                {{ form.last_name|label_with_class:'control-label' }}
                {{ form.last_name }}
            </div>
            <div class="form-group {% if form.past_contributions.errors %}has-error{% endif %}">
                {{ form.past_contributions|label_with_class:'control-label' }}
                {{ form.past_contributions }}
            </div>
            <div class="form-group {% if form.future_plans.errors %}has-error{% endif %}">
                {{ form.future_plans|label_with_class:'control-label' }}
                {{ form.future_plans }}
            </div>
        </div>
        <div class="col-md-4">
            {% if form.image.errors %}
                <div class="alert alert-danger">
                    {% trans 'file_too_large' %}
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
            {% endif %}
            {{ form.image }}
        </div>
    </div>
    <div class="row">
        <div class="col-lg-3 col-xs-12 col-md-4 pull-right">
            <input class="btn btn-primary btn-justified" type="submit" value="{% trans 'save' %}">
        </div>
    </div>
</form>
<hr>
<h2>{% trans "links" %}</h2>
<div class="row" id="links">{% include 'core/edit/links.html' %}</div>
{% endblock %}
